$(document).ready(function() {
	var $container = $('#masonry');
	$('#masonry').infinitescroll({
	        navSelector : "#nav-below",
	        nextSelector: "#nav-below #older_posts a",
	        itemSelector: ".articlebox",
	        extraScrollPx: 10,
	        bufferPx     : 40,
	        animate      : true, 
	    },function(newElements) {
	        var $newElems = $( newElements ).css({ opacity: 0 });
	        $newElems.imagesLoaded(function(){
	          $newElems.animate({ opacity: 1 });
	          $container.masonry( 'appended', $newElems, true );
	        });
	    });
	$('#masonry').imagesLoaded(function(){
	    $('#masonry').masonry();
	});
})